package com.luoke.pojo.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @TableName pet
 */
@Data
public class Pet implements Serializable {

    private Long id;

    private Long attributeId;

    private String name;

    private Integer status;

    private Integer level;

    private Integer hp;

    private Integer mp;

    private String remark;

    private String exp;

    private Date createTime;
    private Attribute attribute;
    private List<Skill> skill;
    private static final long serialVersionUID = 1L;

    public void attacked(Skill skill) {
        this.hp = this.hp - skill.getValue();
        if (this.hp <= 0) {
            this.hp = 0;
        }
    }

    public boolean dead() {
        return this.hp<=0;
    }
}